﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Net;
using System.Net.Sockets;

namespace OrchardSystemServer.Net
{
    public class NetHelper
    {
        /// <summary>
        /// 获得本地IPV4地址
        /// </summary>
        /// <returns></returns>
        public static ArrayList GetLocalIPv4Address()
        {
            ArrayList ipList = new ArrayList();
            IPAddress[] ipAddresses = Dns.GetHostAddresses(Dns.GetHostName());
            for (int i = 0; i < ipAddresses.Length; i++)
            {
                if (ipAddresses[i].AddressFamily == AddressFamily.InterNetwork)//如果是ipv4地址
                    ipList.Add(ipAddresses[i].ToString());
            }
            return ipList;
        }
    }
}
